package com.awtj;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class RoseWithStem extends JPanel {
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.RED);
        int x, y;
        for (double i = 0; i <= 2 * Math.PI; i += Math.PI / 180) {
            x = (int) (Math.cos(i) * Math.cos(4 * i) * 100 + 200);
            y = (int) (Math.sin(i) * Math.cos(4 * i) * 100 + 200);
            g.fillOval(x, y, 2, 2);
        }
        g.setColor(Color.GREEN);
        g.fillRect(200, 400, 2, 200);
        g.fillOval(198, 400, 6, 6);
        g.drawLine(200, 400, 200, 200);
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setSize(400, 600);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new RoseWithStem());
        frame.setVisible(true);
    }
}
